<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>工勿忧</title>
<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>
<style>
	.list {
		border: solid #ddd 1px;border-radius: 5px;width: 97%;margin-left: 3%;margin-top: 15px;background-color: aliceblue;box-shadow: 3px 3px 3px #ccc;
	}
	.list2 {
		border: solid rgb(248, 101, 101) 1px;border-radius: 5px;width: 97%;margin-left:3%;margin-top: 15px;background-color:rgb(253,161,161);box-shadow: 3px 3px 3px rgb(253,161,161);
	}
	table {width:100%}
	table tr td { padding: 5px; }
	.list2 table tr td { color:#ff0; }
	</style>
<body>
	

<div class="hui-wrap" id="record_2">
	<div class="hui-list" style="background:#FFFFFF;margin-top:3px;padding-right:10px;">
		<ul id="list">

		</ul>
	</div>
</div>


<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-tab.js" type="text/javascript"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
apiready = function() {	
	list()
}


function list(){

	api.ajax({
        url: $api.getStorage('geturl')+'&c=ajaxmember&a=updatalist&flag='+$api.getStorage('flag'),
        method: 'post',
        data: {
            values: { 
                userid:$api.getStorage('userid'),
				docid :$api.getStorage('docid')
            }
        }
    },function(res, err){
		//console.log(JSON.stringify(res))
        if (res) {			
            if (res.status==1) {
				//数据上报
				var updata = ''
				for(i=0;i<res.data.length;i++){	
													
					updata += '<div class="list2" onClick="tip('+res.data[i].id+')"><table>'
					updata += '<tr><td style="color:#0000ff;font-size:16px;">用户：' + res.data[i].name + '  &nbsp; &nbsp;  电话：' + res.data[i].tel + ' </td></tr>'
					updata += '<tr><td>血 压 值：' + res.data[i].bloodmin + ' - ' + res.data[i].bloodmax + ' mmHg</td></tr>'
					updata += '<tr><td style="color:#000">标 准 值：' + res.bzz.bloodmin + '~~' + res.bzz.bloodmax + '</td></tr>'
					updata += '<tr><td>血 糖 值：' + res.data[i].bloodsugar + ' mmHg</td></tr>'
					updata += '<tr><td style="color:#000">标 准 值：' + res.bzz.bloodsugarmin + '~~' + res.bzz.bloodsugarmax + '</td></tr>'
					updata += '<tr><td>血 脂 值：' + res.data[i].bloodlipid + ' mmHg</td></tr>'
					updata += '<tr><td style="color:#000">标 准 值：' + res.bzz.bloodlipidmin + '~~' + res.bzz.bloodlipidmax + '</td></tr>'
					updata += '<tr><td>测量时间：' + jsDateDiff(res.data[i].cltime,1) + '</td></tr>'
					updata += '<tr><td>上报时间：' + jsDateDiff(res.data[i].addtime,1) + '</td></tr>'
					updata += '</table></div>'
				}
				hui("#list").html(updata)
                
            }else{
                api.toast({ msg:res.tip,location:'top' })
            }
        } else {
            alert( JSON.stringify( err ) );
        }
    });   

}



hui('#hui-header-menu').click(function(){
    hui.actionSheet(menus, cancel, function(e){
        console.log(e.index);
        hui.toast(e.innerHTML);
    });
});




function tip(id){

    hui.prompt('您确认要这处理吗？', ['取消','确定'], function(name){
        //hui.toast('您输入了 :' + name);
		api.ajax({
			url: $api.getStorage('geturl')+'&c=ajaxmember&a=reportededitstatus&flag='+$api.getStorage('flag'),
			method: 'post',
			data: {
				values: {
					type   : 1,					
					docid  : $api.getStorage('docid'),
					hospid : $api.getStorage('hospid'),
					id     : id,
					memo   : name
				}
			}
		},function(ret, err){
			if (ret) {         
				api.toast({ msg:ret.tip,location:'middle' })
				setTimeout("reload()",1000)
			} else {
				alert( JSON.stringify( err ) );
			}
		});
    }, 
	'例如 : 张三', 
	'已联系本人处理',
	function(){
		//hui.toast('您点击了取消')
	});
}

function tab(i){
	if(i==1){
		hui("#record_1").show();
		hui("#record_2").hide();
		var UILineChart = api.require('UILineChart');
		UILineChart.open();
	}else{
		var UILineChart = api.require('UILineChart');
		UILineChart.close();
		hui("#record_1").hide();
		hui("#record_2").show();
	}
}

</script>

</body>
</html>